import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/login/loginPage.vue'),
    },
    {
      path: '/',
      name: 'main',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('@/frame/MainContainer.vue'),
      children: [
        {
          path: '/home.html',
          name: 'home',
          component: () => import('@/views/HomeView.vue'),
        },
        {
          path: '/user.html',
          name: 'user',
          component: () => import('@/views/users/UserListView.vue'),
        },
        {
          path: '/user/adduser.html',
          name: 'adduser',
          component: () => import('@/views/users/AddUserView.vue'),
        },
        {
          path: '/user/edituser.html',
          name: 'edituser',
          component: () => import('@/views/users/EditUserView.vue'),
        },
        {
          path: '/product.html',
          name: 'product',
          component: () => import('@/views/products/ProductPage.vue'),
        },
      ],
    },
  ],
})

export default router
